package com.lml.practice14.controller;

import com.lml.practice14.entity.R;
import com.lml.practice14.entity.Users;
import com.lml.practice14.mapper.UsersMapper;
import com.lml.practice14.service.UsersService;
import org.springframework.web.bind.annotation.RequestBody;

public class UsersController {
    UsersService UsersService;
    UsersMapper usersMapper;
    public R login(@RequestBody Users users) {
        Users user = UsersService.login(users.getNumber(), users.getPassword());
        if (user != null) {
            return R.ok(user);
        }
        return R.fail(500, "用户名或密码错误");
    }
    public R findAll() {
        return R.ok(usersMapper.selectAll());
    }

}